<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
        /*
        原型
        它是构造函数的一个属性
        它是一个object数据类型
        */

        function Teacher(name, age, id) {
            this.name = name;
            this.age = age;
            this.id = id;
        }
        // console.dir(Teacher);
        Teacher.prototype.x = 55;
        Teacher.prototype.showId = function() {
            alert(this.id);
        }

        //实例
        var afei = new Teacher('阿飞', 30, 111);
        var zhuque = new Teacher('朱雀', 20, 222);
        console.log(afei.x);
        console.log(zhuque.x);

        console.log(afei);
        console.log(zhuque);
        afei.__proto__.x = 66;
        console.log(afei.__proto__ === zhuque.__proto__);

        console.log(zhuque.__proto__ === Teacher.prototype);

    </script>
</body>
</html>